<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Main extends DR_Controller {
	
	public function __Construct()
	{
		parent::__Construct();
		$this->load->model("user");
		$this->set_layout("layout/layout");
	}
	
	public function cari()
	{
		$data = array("nama"=>"index");
		$this->show_view("main/index",$data);	
	}
	
	public function index()
	{
		$data = array("nama"=>"index");
		$this->show_view("main/index",$data);
	}
	
	public function page($page_name=null)
	{
		$this->load->model("halaman");
		$data["c_hal"] = $this->halaman->get_by_judul_file($page_name);
		$this->show_view("main/page",$data);
	}
	
	public function login()
	{
		$user = $this->read_post("user");
		$password = $this->read_post("password");
		
		if($this->user->is_exists($user,$password))
		{
			$cu = $this->user->get_user($user,$password);
			$newdata = array(
							 "id_role"=>1,
							 "username"=>$user
							);
			
			$this->session->set_userdata($newdata);		
			redirect("admin/main/index");
		}	
	}
	
	public function daftar()
	{
		$data = array("title"=>"Pendaftaran");
		$this->set_view("main/layout_daftar","main/daftar",$data);
	}
	
	public function pencarian_lengkap()
	{
	}	
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */